<!DOCTYPE html>
<html>
    <head>
        <title>History</title>
        <link href="Content/bootstrap.css" rel="stylesheet" />
        <link href="Content/bootstrap-datepicker3.css" rel="stylesheet" />
        <link href="Content/site.css" rel="stylesheet" />

        <script src="Scripts/jquery-1.9.1.js"></script>
        <script src="Scripts/bootstrap.js"></script>
        <script src="Scripts/bootstrap-datepicker.js"></script>
    </head>
    <body>
<?php
//foreach(PDO::getAvailableDrivers() as $driver)
//    {
//    echo $driver.'<br />';
//    }
//echo "<br />";
//$hostname = 'localhost';
//
///*** mysql username ***/
//$username = 'root';
//
///*** mysql password ***/
//$password = 'root';
//
//	try {
//    $dbh = new PDO("mysql:host=127.0.0.1;dbname=rapidfireleague;charset=utf8", $username, $password, array(PDO::ATTR_EMULATE_PREPARES => false,PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
//    /*** echo a message saying we have connected ***/
//    
//	foreach($dbh->query('SELECT * from `match`') as $row) {
//        echo '<br />';
//		print_r($row);
//		}
//	echo 'Connected to database';
//    }
//catch(PDOException $e)
//    {
//    echo $e->getMessage();
//    }
/*$dbConnection = new PDO('mysql:host=127.0.0.1;dbname=rapidfireleague;', 'root', 'root');
	foreach($dbConnection->query('SELECT * from players') as $row) {
        print_r($row);}*/
	
	/*$dbConnection = mysql_connect ('127.0.0.1', 'root', 'root')
		or die ('Query failed:' . mysql_error());
	@mysql_select_db ('rapidfireleague' ,$dbConnection)
		or die ('Query failed:' . mysql_error());
	//$insertQuery=sprintf("Insert into `match` values(null,%d,%d,%d)",$roundSchaduleId,$player1Id,$player2Id);
	$insertQuery=("select * from `match`");
	mysql_query($insertQuery,$dbConnection);	
	mysql_free_result($insertQuery);
	mysql_close($dbConnection);	
	while ($arrRecords = mysql_fetch_array($insertQuery)) {
		echo $arrRecords['matchID'];
		echo $arrRecords['round_scheduleID'];
		echo $arrRecords['player1'];
		echo $arrRecords['player2'];
		echo $arrRecords['match_number'];
	}
*/
if(class_exists('SQL_Helper') != true)
{
   include_once("php/sql_helper.php");
};
include_once("php/player.php");
include_once("php/round_repository.php");
include_once("php/division.php");

$r = new RoundRepository;
echo $r->getRoundByDate('2014/04/14');
print_r($r->readRoundSchedule(43));
echo $r->map($r->readRoundSchedule(43))->team1;
 echo $r->map($r->getScheduleByRoundIDAndTeamID(1,32))->team1;


try{
	
$division=$d->map($d->readDivision('P'));
//$a = $d->readDivision('S');
//print_r($d->readDivision('S'));
echo $division->division_name;
} 
catch(Exception $e)
{
	print_r($e->getMessage());
}
//print_r($d->readDivision('S'));

//$query='SELECT * from `players`';
//
//$result = SQL_Helper::executeQuery($query);
// foreach (SQL_Helper::sql_maps($result, 'Player') as $p){
//	 //$p = SQL_Helper::sql_map($row, 'Player');
//	 echo $p->fname.'<br />';
// }
 //$query='Update `divisions` set `division_name`= ? where `divisionID` = ?';
// SQL_Helper::executeNonQuery($query, 'Bronze','B');

?>
    </body>
</html>
